<!DOCTYPE HTML>
<html lang="cn" class="light" dir="ltr">
    <head>
        <!-- Book generated using mdBook -->
        <meta charset="UTF-8">
        <title>Rust开发环境部署 - easy-to-code</title>


        <!-- Custom HTML head -->
        
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="theme-color" content="#ffffff">

        <link rel="icon" href="favicon.svg">
        <link rel="shortcut icon" href="favicon.png">
        <link rel="stylesheet" href="css/variables.css">
        <link rel="stylesheet" href="css/general.css">
        <link rel="stylesheet" href="css/chrome.css">
        <link rel="stylesheet" href="css/print.css" media="print">

        <!-- Fonts -->
        <link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
        <link rel="stylesheet" href="fonts/fonts.css">

        <!-- Highlight.js Stylesheets -->
        <link rel="stylesheet" href="highlight.css">
        <link rel="stylesheet" href="tomorrow-night.css">
        <link rel="stylesheet" href="ayu-highlight.css">

        <!-- Custom theme stylesheets -->

    </head>
    <body class="sidebar-visible no-js">
    <div id="body-container">
        <!-- Provide site root to javascript -->
        <script>
            var path_to_root = "";
            var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
        </script>

        <!-- Work around some values being stored in localStorage wrapped in quotes -->
        <script>
            try {
                var theme = localStorage.getItem('mdbook-theme');
                var sidebar = localStorage.getItem('mdbook-sidebar');

                if (theme.startsWith('"') && theme.endsWith('"')) {
                    localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
                }

                if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
                    localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
                }
            } catch (e) { }
        </script>

        <!-- Set the theme before any content is loaded, prevents flash -->
        <script>
            var theme;
            try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
            if (theme === null || theme === undefined) { theme = default_theme; }
            var html = document.querySelector('html');
            html.classList.remove('light')
            html.classList.add(theme);
            var body = document.querySelector('body');
            body.classList.remove('no-js')
            body.classList.add('js');
        </script>

        <input type="checkbox" id="sidebar-toggle-anchor" class="hidden">

        <!-- Hide / unhide sidebar before it is displayed -->
        <script>
            var body = document.querySelector('body');
            var sidebar = null;
            var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
            if (document.body.clientWidth >= 1080) {
                try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
                sidebar = sidebar || 'visible';
            } else {
                sidebar = 'hidden';
            }
            sidebar_toggle.checked = sidebar === 'visible';
            body.classList.remove('sidebar-visible');
            body.classList.add("sidebar-" + sidebar);
        </script>

        <nav id="sidebar" class="sidebar" aria-label="Table of contents">
            <div class="sidebar-scrollbox">
                <ol class="chapter"><li class="chapter-item expanded "><a href="Where_to_Download.html"><strong aria-hidden="true">1.</strong> 常用编程软件下载地址</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="CS_tutorial.html"><strong aria-hidden="true">1.1.</strong> 程序员内功心法</a></li><li class="chapter-item expanded "><a href="Awesome_software.html"><strong aria-hidden="true">1.2.</strong> 精品软件</a></li><li class="chapter-item expanded "><a href="Vfox_dev.html"><strong aria-hidden="true">1.3.</strong> Vfox下载安装</a></li><li class="chapter-item expanded "><a href="OpenSSL_dev.html"><strong aria-hidden="true">1.4.</strong> OpenSSL下载安装</a></li><li class="chapter-item expanded "><a href="Protobuf_dev.html"><strong aria-hidden="true">1.5.</strong> Protobuf下载安装</a></li><li class="chapter-item expanded "><a href="Qemu_dev.html"><strong aria-hidden="true">1.6.</strong> Qemu下载安装</a></li><li class="chapter-item expanded "><a href="Wireshark_dev.html"><strong aria-hidden="true">1.7.</strong> Wireshark下载安装</a></li><li class="chapter-item expanded "><a href="Npcap_dev.html"><strong aria-hidden="true">1.8.</strong> Npcap下载安装</a></li><li class="chapter-item expanded "><a href="UE_dev.html"><strong aria-hidden="true">1.9.</strong> UE下载设置</a></li></ol></li><li class="chapter-item expanded "><a href="Cpp_dev.html"><strong aria-hidden="true">2.</strong> C++开发环境部署</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="MSVC_dev.html"><strong aria-hidden="true">2.1.</strong> MSVC下载安装</a></li><li class="chapter-item expanded "><a href="Mingw-w64_dev.html"><strong aria-hidden="true">2.2.</strong> Mingw-w64下载安装</a></li><li class="chapter-item expanded "><a href="Cmake_dev.html"><strong aria-hidden="true">2.3.</strong> Cmake下载安装</a></li><li class="chapter-item expanded "><a href="Conan_dev.html"><strong aria-hidden="true">2.4.</strong> Conan下载安装</a></li><li class="chapter-item expanded "><a href="Vcpkg_dev.html"><strong aria-hidden="true">2.5.</strong> Vcpkg下载安装</a></li><li class="chapter-item expanded "><a href="Boost_dev.html"><strong aria-hidden="true">2.6.</strong> Boost下载安装</a></li><li class="chapter-item expanded "><a href="Clion+MSVC_dev.html"><strong aria-hidden="true">2.7.</strong> Clion+MSVC配置</a></li><li class="chapter-item expanded "><a href="MySQL_compile.html"><strong aria-hidden="true">2.8.</strong> MySQL源码编译</a></li><li class="chapter-item expanded "><a href="Clang_dev.html"><strong aria-hidden="true">2.9.</strong> Clang下载安装</a></li></ol></li><li class="chapter-item expanded "><a href="Rust_dev.html" class="active"><strong aria-hidden="true">3.</strong> Rust开发环境部署</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="Awesome_rust.html"><strong aria-hidden="true">3.1.</strong> Rust优秀项目</a></li><li class="chapter-item expanded "><a href="Cargo_kits.html"><strong aria-hidden="true">3.2.</strong> Cargo常用软件</a></li><li class="chapter-item expanded "><a href="Tauri_dev.html"><strong aria-hidden="true">3.3.</strong> Tauri开发</a></li><li class="chapter-item expanded "><a href="Diesel_dev.html"><strong aria-hidden="true">3.4.</strong> Diesel配置</a></li></ol></li><li class="chapter-item expanded "><a href="Python_dev.html"><strong aria-hidden="true">4.</strong> Python安装部署</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="Awesome_py.html"><strong aria-hidden="true">4.1.</strong> Python优秀项目</a></li></ol></li><li class="chapter-item expanded "><a href="Go_dev.html"><strong aria-hidden="true">5.</strong> Go开发环境部署</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="Go_dev_kits.html"><strong aria-hidden="true">5.1.</strong> Go开发插件</a></li></ol></li><li class="chapter-item expanded "><a href="Zig_dev.html"><strong aria-hidden="true">6.</strong> Zig开发环境部署</a></li><li class="chapter-item expanded "><a href="Swift_dev.html"><strong aria-hidden="true">7.</strong> Swift开发环境部署</a></li><li class="chapter-item expanded "><a href="Java_dev.html"><strong aria-hidden="true">8.</strong> Java开发环境部署</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="Maven_dev.html"><strong aria-hidden="true">8.1.</strong> Maven安装配置</a></li><li class="chapter-item expanded "><a href="Selenium_dev.html"><strong aria-hidden="true">8.2.</strong> Selenium开发</a></li></ol></li><li class="chapter-item expanded "><a href="Node_dev.html"><strong aria-hidden="true">9.</strong> Node安装部署</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="Yarn_dev.html"><strong aria-hidden="true">9.1.</strong> Yarn安装部署</a></li><li class="chapter-item expanded "><a href="Vue_dev.html"><strong aria-hidden="true">9.2.</strong> Vue插件安装</a></li></ol></li><li class="chapter-item expanded "><a href="PHPMyAdmin_dev.html"><strong aria-hidden="true">10.</strong> phpMyAdmin越狱</a></li><li class="chapter-item expanded "><a href="Git_init.html"><strong aria-hidden="true">11.</strong> Git初始化配置</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="Git_tutorial.html"><strong aria-hidden="true">11.1.</strong> Git简易教程</a></li><li class="chapter-item expanded "><a href="Git_issues.html"><strong aria-hidden="true">11.2.</strong> Git疑难杂症</a></li></ol></li><li class="chapter-item expanded "><a href="VSCode_dev.html"><strong aria-hidden="true">12.</strong> 实用技能</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="VSCode_dev.html"><strong aria-hidden="true">12.1.</strong> VSCode实用插件</a></li><li class="chapter-item expanded "><a href="Excalidraw_dev.html"><strong aria-hidden="true">12.2.</strong> Excalidraw下载安装部署</a></li><li class="chapter-item expanded "><a href="Hexo_dev.html"><strong aria-hidden="true">12.3.</strong> Hexo个人博客搭建</a></li></ol></li></ol>
            </div>
            <div id="sidebar-resize-handle" class="sidebar-resize-handle">
                <div class="sidebar-resize-indicator"></div>
            </div>
        </nav>

        <!-- Track and set sidebar scroll position -->
        <script>
            var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
            sidebarScrollbox.addEventListener('click', function(e) {
                if (e.target.tagName === 'A') {
                    sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
                }
            }, { passive: true });
            var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
            sessionStorage.removeItem('sidebar-scroll');
            if (sidebarScrollTop) {
                // preserve sidebar scroll position when navigating via links within sidebar
                sidebarScrollbox.scrollTop = sidebarScrollTop;
            } else {
                // scroll sidebar to current active section when navigating via "next/previous chapter" buttons
                var activeSection = document.querySelector('#sidebar .active');
                if (activeSection) {
                    activeSection.scrollIntoView({ block: 'center' });
                }
            }
        </script>

        <div id="page-wrapper" class="page-wrapper">

            <div class="page">
                                <div id="menu-bar-hover-placeholder"></div>
                <div id="menu-bar" class="menu-bar sticky">
                    <div class="left-buttons">
                        <label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
                            <i class="fa fa-bars"></i>
                        </label>
                        <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
                            <i class="fa fa-paint-brush"></i>
                        </button>
                        <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
                            <li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
                            <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
                            <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
                            <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
                            <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
                        </ul>
                        <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
                            <i class="fa fa-search"></i>
                        </button>
                    </div>

                    <h1 class="menu-title">easy-to-code</h1>

                    <div class="right-buttons">
                        <a href="print.html" title="Print this book" aria-label="Print this book">
                            <i id="print-button" class="fa fa-print"></i>
                        </a>

                    </div>
                </div>

                <div id="search-wrapper" class="hidden">
                    <form id="searchbar-outer" class="searchbar-outer">
                        <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
                    </form>
                    <div id="searchresults-outer" class="searchresults-outer hidden">
                        <div id="searchresults-header" class="searchresults-header"></div>
                        <ul id="searchresults">
                        </ul>
                    </div>
                </div>

                <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
                <script>
                    document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
                    document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
                    Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
                        link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
                    });
                </script>

                <div id="content" class="content">
                    <main>
                        <h1 id="rust下载安装配置"><a class="header" href="#rust下载安装配置">Rust下载安装配置</a></h1>
<h2 id="下载"><a class="header" href="#下载">下载</a></h2>
<h3 id="编译器下载"><a class="header" href="#编译器下载">编译器下载</a></h3>
<p>Rust中文官网</p>
<p><a href="https://www.rust-lang.org/zh-CN">https://www.rust-lang.org/zh-CN</a></p>
<p>开发工具下载</p>
<p><a href="https://www.rust-lang.org/tools/install">https://www.rust-lang.org/tools/install</a></p>
<p>其他安装方式（离线开发环境建议下载离线版rust编译器安装包+msvc编译器）</p>
<p><a href="https://forge.rust-lang.org/infra/other-installation-methods.html">https://forge.rust-lang.org/infra/other-installation-methods.html</a></p>
<p>或者离线版rust编译器+mingw编译器</p>
<p>（1）rust-1.61.0-i686-pc-windows-gnu.msi（支持32位windows系统）</p>
<p>（2）i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z（mingw32位g++编译器）</p>
<p>mingw-w64下载</p>
<p><a href="https://www.mingw-w64.org/downloads">https://www.mingw-w64.org/downloads</a> 导航</p>
<p><a href="https://winlibs.com">https://winlibs.com</a> 推荐！</p>
<p><a href="https://github.com/brechtsanders/winlibs_mingw/releases">https://github.com/brechtsanders/winlibs_mingw/releases</a> 推荐！</p>
<h3 id="加速配置"><a class="header" href="#加速配置">加速配置</a></h3>
<p>设置环境变量 RUSTUP_DIST_SERVER （用于更新 toolchain）：
export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static</p>
<p>RUSTUP_UPDATE_ROOT （用于更新 rustup）：
export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup</p>
<p>设置crates-io-index镜像源</p>
<p>export CARGO_REGISTRIES_CRATES_IO_INDEX=http://mirrors.ustc.edu.cn/crates.io-index</p>
<p>export CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse</p>
<p>Rust 提供两种协议来访问 crate 的索引：git 和 sparse，分别适用于不同场景。你可以通过设置 CARGO_REGISTRIES_CRATES_IO_PROTOCOL 来指定使用的协议：</p>
<p>git：通过 Git 拉取索引（传统方式）。</p>
<p>sparse：通过 HTTP 拉取索引（更快，推荐）。</p>
<h3 id="rust标准库源码下载"><a class="header" href="#rust标准库源码下载">Rust标准库源码下载</a></h3>
<p><a href="https://github.com/rust-lang/rust">https://github.com/rust-lang/rust</a></p>
<p>节约硬盘空间</p>
<p>可以移动<code>.cargo</code>和<code>.rustup</code>目录，并相应地设置<code>RUSTUP_HOME</code>和<code>CARGO_HOME</code>。</p>
<p>还需要根据.cargo/bin的地址调整系统变量<code>PATH</code>。</p>
<p>安装历史版本</p>
<p>先查看几月几日发布了某个版本</p>
<p><a href="https://blog.rust-lang.org">https://blog.rust-lang.org</a></p>
<p>或者编译器更新官方日志</p>
<p><a href="https://github.com/rust-lang/rust/blob/master/RELEASES.md">https://github.com/rust-lang/rust/blob/master/RELEASES.md</a></p>
<p>然后根据stable版本发布日期倒推算出nightly版本日期，前一天即可</p>
<pre><code>// win7绝响！！！
rustup  toolchain install nightly-2024-02-20-x86_64-pc-windows-msvc --profile minimal
rustup  toolchain install nightly-2024-02-20-x86_64-pc-windows-gnu  --profile minimal

rustup default nightly-2024-02-20-x86_64-pc-windows-msvc

rustup target install wasm32-unknown-unknown

cargo install wasm-server-runner
cargo install wasm-bindgen-cli
</code></pre>
<p>查看编译工具链类型</p>
<p><a href="https://forge.rust-lang.org/infra/other-installation-methods.html">https://forge.rust-lang.org/infra/other-installation-methods.html</a></p>
<h2 id="rustup操作"><a class="header" href="#rustup操作">Rustup操作</a></h2>
<h3 id="更新"><a class="header" href="#更新">更新</a></h3>
<pre><code>rustup update
</code></pre>
<h3 id="更新指定版本"><a class="header" href="#更新指定版本">更新指定版本</a></h3>
<pre><code>rustup update stable
rustup update nightly
</code></pre>
<h3 id="切换版本"><a class="header" href="#切换版本">切换版本</a></h3>
<pre><code>rustup override set nightly
</code></pre>
<h3 id="添加night版本"><a class="header" href="#添加night版本">添加night版本</a></h3>
<pre><code>rustup toolchain install nightly
</code></pre>
<h3 id="设置默认版本"><a class="header" href="#设置默认版本">设置默认版本</a></h3>
<pre><code>rustup default stable

rustup default unstable

//查看现在默认的编译器版本
rustup show
</code></pre>
<h3 id="一顿连招"><a class="header" href="#一顿连招">一顿连招</a></h3>
<pre><code>//更改默认的host（即编译目标）
rustup set default-host x86_64-pc-windows-msvc

//安装core、alloc、std库源码
rustup component add rust-src --toolchain stable-x86_64-pc-windows-msvc

//用于编译wasm，你懂的
rustup target install wasm32-unknown-unknown

//交叉编译
rustup target add x86_64-pc-windows-msvc
rustup target add i686-pc-windows-msvc

//用于开发android
rustup target add aarch64-linux-android

rustup toolchain install stable-i686-pc-windows-msvc --profile minimal
rustup toolchain install nightly-i686-pc-windows-msvc --profile minimal
rustup toolchain install stable-x86_64-pc-windows-msvc --profile minimal
rustup toolchain install nightly-x86_64-pc-windows-msvc --profile minimal

rustup default stable-x86_64-pc-windows-msvc

//添加rust官方库html文档
rustup component add --toolchain stable-x86_64-pc-windows-msvc rust-docs

//按需
//rustup component add --toolchain stable-i686-pc-windows-msvc rust-docs
//rustup component add --toolchain nightly-i686-pc-windows-msvc rust-docs
//rustup component add --toolchain nightly-x86_64-pc-windows-msvc rust-docs

//一顿更新
rustup update

//安装代码格式化插件
rustup component add rustfmt

//clippy工具是一系列lint的集合,用于捕捉常见错误和改进 Rust代码
rustup component add clippy-preview
</code></pre>
<h3 id="mingw编译器型号说明"><a class="header" href="#mingw编译器型号说明">mingw编译器型号说明</a></h3>
<p>型号列表</p>
<p>x86_64:代表64位系统运行（电脑操作系统）</p>
<p>x86_win32:代表32位系统运行（电脑操作系统）</p>
<p>x86_64-posix-sjlj</p>
<p>x86_64-posix-seh</p>
<p>x86_64-win32-sjlj</p>
<p>x86_64-win32-seh</p>
<p>i686-posix-sjlj</p>
<p>i686-posix-dwarf</p>
<p>i686-win32-sjlj</p>
<p>i686-win32-dwarf</p>
<p>释义1：</p>
<p>DWARF：一种带调试信息(DWARF- 2（DW2）EH)的包, 所以比一般的包尺寸大，仅支持32位系统</p>
<p>SJLJ：跨平台，支持32，64位系统，缺点是：运行速度稍慢，GCC不支持</p>
<p>SEH: 调用系统机制处理异常，支持32，64位系统，缺点是：Gcc不支持（即将支持）</p>
<p>释义2：</p>
<p>x86_64: 简称X64，64位操作系统</p>
<p>i686: 32位操作系统 (i386的子集)，差不多奔腾2(1997年5月)之后的CPU都是可以用的；</p>
<p>释义3：</p>
<p>posix: 启用了C++ 11 多线程特性</p>
<p>win32: 未启用 （从时间线上正在尝试也启用部分 Threading）</p>
<p>区别</p>
<p>DWARF DWARF- 2（DW2）EH ，这需要使用DWARF-2（或DWARF-3）调试信息。 DW-2 EH可以导致可执行文件略显膨胀，因为大的调用堆栈解开表必须包含在可执行文件中。</p>
<p>setjmp / longjmp（SJLJ）。基于SJLJ的EH比DW2 EH慢得多（在没有异常时会惩罚甚至正常执行），但是可以在没有使用GCC编译的代码或没有调用堆栈的代码上工作。</p>
<p>结构化异常处理（SEH） （Structured Exception Handling）Windows使用自己的异常处理机制。</p>
<p>3、clion下载及安装（不解释）</p>
<h2 id="configtoml配置"><a class="header" href="#configtoml配置">config.toml配置</a></h2>
<pre><code>[source.crates-io]

registry = "https://github.com/rust-lang/crates.io-index"

replace-with = 'ustc'

#replace-with ='sjtu'

#replace-with = 'local-registry'

#中国科学技术大学

[source.ustc]

registry = "https://mirrors.ustc.edu.cn/crates.io-index"

#上海交通大学

[source.sjtu]

registry="https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index/"

#清华大学

[source.tuna]

registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"

#本地仓库地址

[source.local-registry]

local-registry = 'C:/Users/Administrator/.cargo/local-registry/'

[build]

#启用静态编译，仅用于windows

rustflags = ["-C", "target-feature=+crt-static"]

#节约硬盘空间

target-dir = "D:/rust-target"

#设置为从git拉取。git不会被墙。

[net]

git-fetch-with-cli=true

#用于解决报错Caused by: [35]SSL connect error

[http]

check-revoke = false
</code></pre>
<h2 id="cargo-local-registry可下载依赖离线使用"><a class="header" href="#cargo-local-registry可下载依赖离线使用">cargo-local-registry（可下载依赖离线使用）</a></h2>
<h3 id="安装"><a class="header" href="#安装">安装</a></h3>
<p>generate local registry</p>
<p>cargo install cargo-local-registry</p>
<p>cargo local-registry --sync <path of Cargo.toml> <path of local registory></p>
<h3 id="使用"><a class="header" href="#使用">使用</a></h3>
<h4 id="下载依赖"><a class="header" href="#下载依赖">下载依赖</a></h4>
<p>cargo local-registry --sync 222</p>
<p>"C:/Program Files (x86)/Rust nightly MSVC 1.68/bin/cargo.exe"  local-registry --sync Cargo.toml  local-registry</p>
<p>pause</p>
<h4 id="增量下载依赖"><a class="header" href="#增量下载依赖">增量下载依赖</a></h4>
<p>"C:/Program Files (x86)/Rust nightly MSVC 1.68/bin/cargo.exe"  local-registry --sync Cargo.toml  --no-delete C:/Users/Administrator/.cargo/local-registry</p>
<h2 id="vs-code及插件"><a class="header" href="#vs-code及插件">VS Code及插件</a></h2>
<h3 id="vs-code下载"><a class="header" href="#vs-code下载">VS Code下载</a></h3>
<p><a href="https://code.visualstudio.com/">https://code.visualstudio.com</a></p>
<h3 id="vs-code-插件下载"><a class="header" href="#vs-code-插件下载">VS Code 插件下载</a></h3>
<p><a href="https://marketplace.visualstudio.com/vscode">https://marketplace.visualstudio.com/vscode</a></p>
<h4 id="rust-analyzer"><a class="header" href="#rust-analyzer">rust-analyzer</a></h4>
<p><a href="https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer">https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer</a></p>
<p>rust-analyzer：它会实时编译和分析你的 Rust 代码，提示代码中的错误，并对类型进行标注。</p>
<h4 id="even-better-toml"><a class="header" href="#even-better-toml">even-better-toml</a></h4>
<p><a href="https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml">https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml</a></p>
<p>even-better-toml：Rust 使用 toml 做项目的配置管理</p>
<h4 id="rust-syntax"><a class="header" href="#rust-syntax">rust-syntax</a></h4>
<p><a href="https://marketplace.visualstudio.com/items?itemName=dustypomerleau.rust-syntax">https://marketplace.visualstudio.com/items?itemName=dustypomerleau.rust-syntax</a></p>
<p>rust syntax：为代码提供语法高亮</p>
<h4 id="rust-test-lens"><a class="header" href="#rust-test-lens">rust test lens</a></h4>
<p><a href="https://marketplace.visualstudio.com/items?itemName=hdevalke.rust-test-lens">https://marketplace.visualstudio.com/items?itemName=hdevalke.rust-test-lens</a></p>
<p>rust test lens：可以帮你快速运行某个 Rust 测试</p>
<h4 id="crates"><a class="header" href="#crates">crates</a></h4>
<p><a href="https://marketplace.visualstudio.com/items?itemName=serayuzgur.crates">https://marketplace.visualstudio.com/items?itemName=serayuzgur.crates</a></p>
<p>crates 帮助你分析当前项目的依赖是否是最新的版本</p>
<h4 id="cpptools"><a class="header" href="#cpptools">cpptools</a></h4>
<p><a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools">https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools</a></p>
<p>用于调试代码</p>
<h4 id="调试插件"><a class="header" href="#调试插件">调试插件</a></h4>
<p>如何调试</p>
<p><a href="https://blog.csdn.net/uddiqpl/article/details/108558712">https://blog.csdn.net/uddiqpl/article/details/108558712</a></p>
<p>windows</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools">https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools</a></p>
<p>linux</p>
<p><a href="https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb">https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb</a></p>
<p>点击 调试 -&gt; 添加配置</p>
<p>如果你使用的是 Windows，选择 C++ (Windows)</p>
<p>如果你使用的是 Mac/Linux，选择 LLDB: Custom Launch</p>
<p>添加配置应该会创建并打开启动配置文件 launch.json。 你必须手动修改配置项 "program" 对应的可执行文件名称。</p>
<pre><code>{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(Windows) Launch",
            "type": "cppvsdbg",
            "request": "launch",
            "program": "${workspaceRoot}/target/debug/foo.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceRoot}",
            "environment": [],
            "externalConsole": true
        },
        {
            "name": "(OSX) Launch",
            "type": "lldb",
            "request": "launch",
            "program": "${workspaceRoot}/target/debug/foo",
            "args": [],
            "cwd": "${workspaceRoot}",
        }
    ]
}
</code></pre>
<h2 id="发布rust源码包"><a class="header" href="#发布rust源码包">发布rust源码包</a></h2>
<h3 id="cargotoml信息确认"><a class="header" href="#cargotoml信息确认">Cargo.toml信息确认</a></h3>
<p>authors 作者</p>
<p>description 源码包的描述, 比较简短 (可以使用中文)</p>
<p>repository 对应源代码仓库的 URL</p>
<p>keywords 关键词</p>
<p>categories 源码包所属的分类 最多 5 个, 只能从这个列表中选择: https://crates.io/category_slugs</p>
<p>除了 <strong>Cargo.toml</strong> 文件, 还要检查一下 <strong>README.md</strong> 文件, 这个是项目的说明文件, 别人点进去首先看到的东西.</p>
<p>最后使用命令 <code>cargo doc</code> 编译一下文档, 在本地先看看文档是否还需要补充</p>
<h3 id="登录"><a class="header" href="#登录">登录</a></h3>
<pre><code class="language-bash">//把登录的token黏贴进去
cargo login --registry crates-io
</code></pre>
<h3 id="发布"><a class="header" href="#发布">发布</a></h3>
<pre><code>cargo publish --registry crates-io --allow-dirty
</code></pre>

                    </main>

                    <nav class="nav-wrapper" aria-label="Page navigation">
                        <!-- Mobile navigation buttons -->
                            <a rel="prev" href="Clang_dev.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
                                <i class="fa fa-angle-left"></i>
                            </a>

                            <a rel="next prefetch" href="Awesome_rust.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
                                <i class="fa fa-angle-right"></i>
                            </a>

                        <div style="clear: both"></div>
                    </nav>
                </div>
            </div>

            <nav class="nav-wide-wrapper" aria-label="Page navigation">
                    <a rel="prev" href="Clang_dev.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
                        <i class="fa fa-angle-left"></i>
                    </a>

                    <a rel="next prefetch" href="Awesome_rust.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
                        <i class="fa fa-angle-right"></i>
                    </a>
            </nav>

        </div>




        <script>
            window.playground_copyable = true;
        </script>


        <script src="elasticlunr.min.js"></script>
        <script src="mark.min.js"></script>
        <script src="searcher.js"></script>

        <script src="clipboard.min.js"></script>
        <script src="highlight.js"></script>
        <script src="book.js"></script>

        <!-- Custom JS scripts -->


    </div>
    </body>
</html>
